var RM008A = {};

RM008A.clearHeaderCriteria = function(){
    $('.required').unValidate();
    $('#userName').clear();
    $('#firstName').clear();
    $('#lastName').clear();
    $('#role').clear();
    $('#email').clear();
    $('#active').clear();
};

RM008A.init = function() {
	_COMBOBOX.TowerFloorUnitAddrCombo('tower', 'floor' , 'unit' , 'address','roomId'); // Load Tower Criteria Combobox
    _COMMON.renderDatePicker('sreqhreqdat');
    _COMMON.renderDatePicker('sreqhresdat');
    _COMMON.renderDatePicker('sreqhwtdat');
    _COMMON.renderDatePicker('sreqcptdate');
    _COMMON.renderTimePicker('sreqhasto');
    _COMMON.renderTimePicker('sreqhrestm');
    _COMMON.renderTimePicker('sreqhwttm');
    _COMMON.renderTimePicker('sreqhcuswttm');
    _COMMON.renderTimePicker('sreqcpttm');
};

RM008A.validate = function() {
   
   $('input').unValidate();
   
   var v1 = $('input.required').validate();
   var v2 = $('#password').validate();
   var v3 = $('#confirmPassword').validate();
   var v4 = false;
   
   _log($('#userId').val());
   if($('#userId').val() != ''){
       v2 = true ;
       v3 = true ;
       $('#password').unValidate();
       $('#confirmPassword').unValidate();
   }else{
       v2 = $('#password').validate();
       v3 = $('#confirmPassword').validate();
   }
   
   if (v1 && $('#password').val() != $('#confirmPassword').val()) {
      notif({
          msg: "<b><i class='fa fa-thumbs-o-down'></i> Confirm Password is not match !</b>",
          type: "error",
          position: "center"
      });
      $('#confirmPassword').addClass('input-invalid');
      v4 = false;
  }else{
      $('confirmPassword').unValidate();
      v4 = true;
  }
  
   return v1&&v2&&v3&&v4;
};


$(document).ready(function() {    
	RM008A.init();
    $("#btnSubmit").click(function() {
	if(RM008A.validate()){
	    $('form').submit();
	}
    });
    
});
